#include <bits/stdc++.h>
#ifndef DEBUG
#define debug
#endif
using namespace std;
using i64 = int64_t;

int f[52][51][51][51];
int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> w(n + 1);
  for (int i = 1; i <= n; i ++) cin >> w[i];
  auto ww = w;
  sort(ww.begin(), ww.end());
  ww.erase(unique(ww.begin(), ww.end()), ww.end());
  for (int i = 1; i <= n; i ++) {
    w[i] = lower_bound(ww.begin(), ww.end(), w[i]) - ww.begin();
  }
  int m = ww.size();
  vector<vector<int>> dp(n + 2, vector<int>(n + 1));
  for (int l = n; l >= 1; l --) {
    for (int r = l; r <= n; r ++) {
      dp[l][r] = INT_MAX / 2;
      for (int k = l; k < r; k ++) {
        dp[l][r] = min(dp[l][r], dp[l][k] + dp[k + 1][r]);
      }

      memset(f[l][r], 0x7f, sizeof(f[l][r]));
      if (l == r) f[l][r][w[l]][w[l]] = a;
      for (int k = l; k < r; k ++) {
        for (int i = 1; i < m; i ++) {
          for (int j = 1; j < m; j ++) {
            auto &v = f[l][r][min(i, w[r])][max(j, w[r])];
            v = min(v, f[l][k][i][j] + dp[k + 1][r - 1]);
          }
        }
      }
      for (int i = 1; i < m; i ++) {
        for (int j = 1; j < m; j ++) {
          dp[l][r] = min(dp[l][r], f[l][r][i][j] + b * (ww[i] - ww[j]) * (ww[i] - ww[j]));
        }
      }
    }
  }
  debug(dp);
  cout << dp[1][n] << endl;
}